#!/usr/bin/python3
# -*- coding: utf8 -*-
# Date   : 2021/08/14
# Author : Kwan
# Email  : allenxian@live.com
# Blog   : https://my.oschina.net/u/4173440

from threading import Thread
from queue import Queue
from time import sleep
from project.define import dev_logger


class LEDService:
    # 发送队列
    SendQ = Queue()

    def __init__(self, **kwargs) -> None:
        self.GateID = kwargs.get('GateID')
        self.GateName = kwargs.get('GateName')
        self.LEDAddr = kwargs.get('LEDAddr')
        self.Port = kwargs.get('Port')
        self.Position = kwargs.get('Position')
        self.__vehicle_types = {"Car":"私家車","Moto":"電單車"}
        self.__parking_types = {"Hourly":"時租","Monthly":"月租","Private":"專用"}
        self.__gate_types = {"Entrance":"入場","Exit":"離場"}
        self.__default_message = ['歡迎光臨','車牌識別','一車一杆','小心駕駛']
        self.__message_types = ['LicensePlate','VehicleType','GateMessage','GateTemp']
    
    def send_message(self, **kwargs):
        """
        发送消息
        """
        msg = [
            kwargs.get('LicensePlate'), 
            self.__vehicle_types.get(kwargs.get('VehicleType')), 
            kwargs.get('GateMessage'), 
            f"體溫{kwargs.get('GateTemp')}"
            ]
        dev_logger.debug(f"{self.GateName}显示屏更新 => {msg}")
        

    def send_default(self):
        """
        显示默认
        """
        dev_logger.debug(f"{self.GateName}显示屏默认 => {self.__message_types}")

    